home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / quake.zip / HIPGRAPL.ZIP / HIPDECOY.QC < prev    next >
Text File  |  1997-02-03  |  4KB  |  170 lines

  1. /*
  2. ==============================================================================
  3.  
  4. PLAYER decoy
  5.  
  6. ==============================================================================
  7. */
  8.  
  9. $cd id1/models/player_4
  10. $origin 0 -6 24
  11. $base base
  12. $skin skin
  13.  
  14. //
  15. // running
  16. //
  17. $frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
  18.  
  19. $frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
  20.  
  21. //
  22. // standing
  23. //
  24. $frame stand1 stand2 stand3 stand4 stand5
  25.  
  26. $frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
  27. $frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
  28.  
  29.  
  30. void()   decoy_stand1 =[  $axstnd1,   decoy_stand1  ]
  31.    {
  32.    ChangeYaw();
  33.    if (self.walkframe >= 5)
  34.       self.walkframe = 0;
  35.    self.frame = $stand1 + self.walkframe;
  36.     self.walkframe = self.walkframe + 1;
  37.     if (time > self.pausetime)
  38.         self.th_walk ();
  39.    };
  40.  
  41. void()   decoy_walk1 =[  $rockrun1,  decoy_walk1  ]
  42.    {
  43. //   local vector a;
  44.    movetogoal (12);
  45. //   a = '0 0 0';
  46. //   a_y = self.ideal_yaw;
  47. //   makevectors(a);
  48. //   self.velocity = 1*v_forward;
  49.    self.weaponframe=0;
  50.    if (self.walkframe == 6)
  51.       self.walkframe = 0;
  52.    if (self.walkframe == 2 || self.walkframe == 5)
  53.       {
  54.       local float r;
  55.       r = random();
  56.       if (r < 0.14)
  57.          sound (self, CHAN_VOICE, "misc/foot1.wav", 0.5, ATTN_NORM);
  58.       else if (r < 0.29)
  59.          sound (self, CHAN_VOICE, "misc/foot2.wav", 0.5, ATTN_NORM);
  60.       else if (r < 0.43)
  61.          sound (self, CHAN_VOICE, "misc/foot3.wav", 0.5, ATTN_NORM);
  62.       else if (r < 0.58)
  63.          sound (self, CHAN_VOICE, "misc/foot4.wav", 0.5, ATTN_NORM);
  64.       else if (r < 0.72)
  65.          sound (self, CHAN_VOICE, "misc/foot5.wav", 0.5, ATTN_NORM);
  66.       else if (r < 0.86)
  67.          sound (self, CHAN_VOICE, "misc/foot6.wav", 0.5, ATTN_NORM);
  68.       else
  69.          sound (self, CHAN_VOICE, "misc/foot7.wav", 0.5, ATTN_NORM);
  70.       }
  71.    self.frame = self.frame + self.walkframe;
  72.     self.walkframe = self.walkframe + 1;
  73.    };
  74.  
  75. void(entity decoy) setup_decoy =
  76. {
  77.    local entity pl;
  78.  
  79.    decoy.classname = "monster_decoy";
  80.    setmodel (decoy, "progs/player.mdl");
  81.    setsize (decoy, VEC_HULL_MIN, VEC_HULL_MAX);
  82.    decoy.view_ofs = '0 0 22';
  83.  
  84.    decoy.solid = SOLID_SLIDEBOX;
  85.    decoy.movetype = MOVETYPE_STEP;
  86.  
  87.    decoy.health = 3000000;
  88.  
  89.    decoy.th_stand = decoy_stand1;
  90.    decoy.th_walk = decoy_walk1;
  91.    decoy.th_run = decoy_walk1;
  92.    decoy.th_missile = decoy_stand1;
  93.    decoy.th_pain = decoy_stand1;
  94.    decoy.th_die = decoy_stand1;
  95.  
  96.    pl = find (world, classname, "player");
  97.    decoy.colormap = pl.colormap;
  98. };
  99.  
  100. /*QUAKED monster_decoy (1 0 0) (-16 -16 -24) (16 16 40)
  101. */
  102. void() monster_decoy =
  103. {
  104.    if (deathmatch)
  105.     {
  106.         remove(self);
  107.         return;
  108.     }
  109.    setup_decoy(self);
  110.  
  111.    walkmonster_start ();
  112.    total_monsters = total_monsters - 1;
  113. };
  114.  
  115. void(string targ, vector orig) become_decoy =
  116. {
  117.    local entity pl;
  118.    local entity decoy;
  119.    local entity temp;
  120.  
  121.    decoy = hipdecoy = spawn();
  122.  
  123.    temp = self;
  124.    self = decoy;
  125.  
  126.    setup_decoy(decoy);
  127.  
  128.    setorigin(decoy, orig);
  129.  
  130.    decoy.origin = orig;
  131.  
  132.    decoy.target = targ;
  133.  
  134.    decoy.takedamage = DAMAGE_AIM;
  135.  
  136.    decoy.ideal_yaw = decoy.angles * '0 1 0';
  137.    if (!decoy.yaw_speed)
  138.       decoy.yaw_speed = 20;
  139.    decoy.use = monster_use;
  140.  
  141.    decoy.flags = decoy.flags | FL_MONSTER;
  142.  
  143.    if (decoy.target)
  144.     {
  145.       decoy.goalentity = decoy.movetarget = find(world, targetname, decoy.target);
  146.       decoy.ideal_yaw = vectoyaw(decoy.goalentity.origin - decoy.origin);
  147.       if (!decoy.movetarget)
  148.         {
  149.             dprint ("Monster can't find target at ");
  150.          dprint (vtos(decoy.origin));
  151.             dprint ("\n");
  152.         }
  153. // this used to be an objerror
  154.       if (decoy.movetarget.classname == "path_corner")
  155.          decoy.th_walk ();
  156.         else
  157.          decoy.pausetime = 99999999;
  158.          decoy.th_stand ();
  159.     }
  160.     else
  161.     {
  162.       decoy.pausetime = 99999999;
  163.       decoy.th_stand ();
  164.     }
  165.  
  166. // spread think times so they don't all happen at same time
  167.    decoy.nextthink = decoy.nextthink + random()*0.5;
  168.    self = temp;
  169. };
  170.